package com.job.service;

import com.job.dao.ResumeDao;
import com.job.dao.UserDao;
import com.job.model.Resume;
import com.job.model.User;
import org.hibernate.engine.spi.Mapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class UserService {
private UserDao userDao;
private ResumeDao resumeDao;

    /**
     *验证登录并返回 用户对象
     * @param userName
     * @param pass
     * @return
     */
    @Transactional
    public User login(String userName, String pass){

        User user=userDao.getUser(userName,pass);
        return user;
    }

    /**
     * 登录成功后获取 自己的简历
     * @param userId
     * @return
     */
    @Transactional
    public List<Resume> loginGetResume(int userId){
     return resumeDao.getResume(userId);
    }


    @Autowired
    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }

    @Autowired
    public void setResumeDao(ResumeDao resumeDao) {
        this.resumeDao = resumeDao;
    }
}
